package com.lanyun.web.enums;

import lombok.Getter;

/**
 * @Author Jqcc
 * @Version 1.0
 * @Data 2024/2/14
 */

@Getter
public enum ResultCodeEnum {

    SUCCESS(200, "操作成功"),

    FAILED(500, "操作失败");

    private int code;

    private String desc;

    ResultCodeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ResultCodeEnum getByCode(int codeVal) {
        for (ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()) {
            if (resultCodeEnum.code == codeVal) {
                return resultCodeEnum;
            }
        }
        return null;
    }

}
